#include "ODN_PropEntity.h"

#include "ODN_GameMgr.h"

namespace ouden {

CPropEntity::CPropEntity(String sName) : CModelEntity(sName)
{
    // TODO: add articulated bodies, using blueprints etc
	//"PropEntity" + PropEntityNumber++
    m_pOgreEntity = CGameMgr::getInstance()->getSceneMgr()->createEntity(m_sName, "cube.mesh");

    Ogre::SceneNode* pBoxNode = CGameMgr::getInstance()->getSceneMgr()->getRootSceneNode()->
			createChildSceneNode();

    pBoxNode->attachObject(m_pOgreEntity);
	m_pOgreEntity->setMaterialName("Examples/OffsetMapping/Specular"); //CRAP
	m_pOgreEntity->setNormaliseNormals(true); // Keep the normals normalized even after scaling.
    m_pOgreEntity->setVisible(true);
    //std::cout << "hereBOX1" << std::endl;

    m_pOgreEntity->_updateAnimation();
    simState = RAGDOLLING;
    //std::cout << "hereBOX2" << std::endl;


    opal::Simulator* sim = CGameMgr::getInstance()->getSimulator();
    opal::Solid* solid = sim->createSolid();

    opal::BoxShapeData box;
    box.dimensions.set(1.0,1.0,1.0);
    //capsule.contactGroup = 1;
    solid->addShape(box);

    solid->setStatic(false);


    // Create ModelBit that ties physics to graphics
    //m_pRootBit = new CModelBit(solid, pBoxNode, NULL);




}

} //namespace ouden
